<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        require_once(__DIR__ . "/includes/seguridad.php");
        session_start();
        $actual = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
        $salir = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . "/atletismo/comun/salir.php";
        $_SESSION['afterLogin'] = $actual;
        $host = $_SERVER['SERVER_NAME'];
        
        if (!isset($_SESSION['username'])) {
            header('Location: http://' . $host . '/atletismo/comun/loginForm.html');
        } else {
            //print_r ($_SESSION);
            if (isUserInRol($_SESSION['username'],"admin")) {
                print " <div><a href=\"calendario/login.php\">Gestionar Calendario</a></div>";
                print " <div><a href=\"comun/usuarios.php\">Gestion Usuarios</a></div>";
                print " <div><a href=\"comun/atletas.php\">Gestion Atletas</a></div>";
            }
            
            if (isUserInRol($_SESSION['username'],"club")) {
                print "<div><a href=\"clubes/login.php\">Gestion Clubes</a></div>  ";
            }
            
            if (isUserInRol($_SESSION['username'],"organizador")) {
                print "<div><a href=\"resultados/login.php\">Organizacion Competiciones</a></div>";
            }
            
            print "<hr>";
            print "<div><a href=\"" . $salir . "\">Salir</a></div>";
        }
        ?>
    </body>
</html>
